<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/templates/template.xhtml">
	<ui:define name="content">
		<h1>
			<h:outputText value="Halaman Perubahan Data Stok" />
		</h1>
		<h:form id="tableform">
		<p:dataTable var="productStore" value="#{productStoreOpnamePage.productStoreDataModel}"
				selection="#{productStoreOpnamePage.selectedProductStore}" selectionMode="single" rowKey="#{productStore}">
				<p:growl id="growl" showDetail="true" />
				<f:facet name="header">
					Daftar Stok
				</f:facet>
				<p:column>
					<f:facet name="header">
						<h:outputText value="Nama Toko" />
					</f:facet>
					<h:outputText value="#{productStore.store.storeName}" />
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputText value="Kode Product" />
					</f:facet>
					<h:outputText value="#{productStore.product.productCode}" />
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputText value="Nama Product" />
					</f:facet>
					<h:outputText value="#{productStore.product.productName}" />
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputText value="Jumlah" />
					</f:facet>
					<h:outputText value="#{productStore.quantity}" />
				</p:column>
			 	<f:facet name="footer">
			 		<div style="text-align: left;">
					<p:commandButton update=":content" oncomplete="productEditDialog.show()" icon="ui-icon-search" title="View" value="Ubah Stok"/>
			 		</div>
			 	</f:facet>
			</p:dataTable>
		</h:form>
		<h:form id="editForm">
			<p:dialog header="Rician Product Untuk Toko" widgetVar="productEditDialog"
				resizable="false" id="productstredit" showEffect="fade"
				hideEffect="explode" modal="true">
					<p:fieldset>
						<h:panelGrid columns="2" cellpadding="7">
							<h:outputText value="Nama Toko" />
							<h:outputText value="#{productStoreOpnamePage.selectedProductStore.store.storeName}" id="storeName_view"/>
							
							<h:outputText value="Kode Product" />
							<h:outputText value="#{productStoreOpnamePage.selectedProductStore.product.productCode}" id="productCode_view"/>
							
							<h:outputText value="Nama Product" />
							<h:outputText value="#{productStoreOpnamePage.selectedProductStore.product.productName}" id="product_name_view" />
							
							<h:outputText value="Nomor Barcode" />
							<h:outputText value="#{productStoreOpnamePage.selectedProductStore.product.barcodeNumber}" id="barcodeNumber_view" />
							
							<h:outputText value="Kemasan" />
							<h:outputText value="#{productStoreOpnamePage.selectedProductStore.product.packageCode.packageId}" id="packageCode_view" />
							
							<h:outputText value="Merek" />
							<h:outputText value="#{productStoreOpnamePage.selectedProductStore.product.brand.brandName}" id="brandName_view"/>
							
							<h:outputText value="Kategori" />
							<h:outputText value="#{productStoreOpnamePage.selectedProductStore.product.category.categoryName}" id="category_view" />
							
							<h:outputText value="Jumlah Barang" />
							<p:inputText value="#{productStoreOpnamePage.selectedProductStore.quantity}" id="product_store_quantity"/>
							
							<p:commandButton action="#{productStoreOpnamePage.saveProductStore}" value="Ubah" onclick="productEditDialog.hide();" update=":content"/>
						</h:panelGrid>
					</p:fieldset>
			</p:dialog>
		</h:form>
	</ui:define>
</ui:composition>